/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fatecpg.songs.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Marcos
 */
@SequenceGenerator(name="SEQCITY", sequenceName="SEQCITY", allocationSize=1, initialValue=1)
@Entity(name="City")
@Table(name="TB_CITY")
public class City implements Persistent{
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="SEQCITY")
    @Column(name="id")
    private Long id;
    
    @Column(name = "name")
    private String name;
    
    @Column(name = "state_name")
    private String state;
    
    @Column(name = "country_name")
    private String country;

    @Override
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }        

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }        
    
    public String getDescription(){
        return name + "/" + state + " - " + country;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final City other = (City) obj;
        if (this.id != other.id) {
            return false;
        }
        return true;
    }          
}
